import { http } from "@/utils/http";
import { pageData } from "@/Model/pageDataBase";
import { resultBase, resultNotDataBase } from "@/Model/resultBase";
import { contentsVM, contentsselect } from "@/Model/contents";

/**
 * 获取分页数据
 */
export const getPageDataApi = (data?: object) => {
  return http.request<resultBase<pageData<contentsVM>>>(
    "post",
    "/api/Contents/GetPageList",
    {
      data
    }
  );
};
/**
 * 添加数据
 */
export const addApi = (data?: object) => {
  return http.request<resultBase<contentsVM>>("post", "/api/Contents/Created", {
    data
  });
};

/**
 * 禁用数据
 */
export const deleteApi = (data?: object) => {
  return http.request<resultNotDataBase>("post", "/api/Contents/Disable", {
    data
  });
};
/**
 * 启用数据
 */
export const enableApi = (data?: object) => {
  return http.request<resultNotDataBase>("post", "/api/Contents/Enable", {
    data
  });
};

/**
 * 修改数据
 */
export const updataApi = (data?: object) => {
  return http.request<resultBase<contentsVM>>("post", "/api/Contents/Update", {
    data
  });
};
/**
 * 按标题查询select控件需要的数据
 */
export const getLikeTitleSelectDataApi = (data?: string) => {
  return http.request<resultBase<contentsselect[]>>(
    "get",
    "/api/Contents/GetLikeTitleList?title=" + data
  );
};
